<html>
<head>
  <meta charset="utf-8">
  <title>k1945</title>
  <link type="text/css" rel="stylesheet" href="pixijs/joystick/joystick.css" />
</head>
<script src="pixijs/pixi.min.js"></script>
<script src="pixijs/spriteUtilities.js"></script>
<script src="pixijs/Sound.js"></script>
<script src="pixijs/joystick/nipplejs.js"></script>
<script src="pixijs/joystick/joystick.js"></script>

<script src="core/calcDir.js"></script>
<script src="core/displayLayer.js"></script>
<script src="core/modal.js"></script>
<script src="core/object.js"></script>
<script src="core/backgroundobject.js"></script>
<script src="core/airplane.js"></script>
<script src="core/groundobject.js"></script>
<script src="core/bullet.js"></script>
<script src="core/aimbullet.js"></script>
<script src="core/container.js"></script>
<script src="core/expaimbullet.js"></script>

<script src="core/tracer_object.js"></script>
<script src="core/geardown.js"></script>
<script src="core/bigtracertobject.js"></script>
<script src="core/pickup_object.js"></script>

<script src="core/trackobject.js"></script>
<script src="core/groundTrackObject.js"></script>
<script src="core/bigobject.js"></script>
<script src="core/blastobject.js"></script>
<script src="core/playerselectobject.js"></script>
<script src="core/player.js"></script>
<script src="core/player_data.js"></script>
<script src="core/startstageobject.js"></script>
<script src="core/clearstageobject.js"></script>
<script src="core/playermanager.js"></script>
<script src="core/loader.js"></script>
<script src="core/manager.js"></script>
<body style="overflow:hidden;overflow-y:hidden;margin:0;background-color:black;">
<div id="left" style="position: absolute; background: transparent; left: 8%"></div>
<div id="right" style="position: absolute; background: transparent; left: 60%"></div>

<script type="text/javascript">
  //游戏定的全局常量
  let Const = {
    // 定义屏幕的大小
    SCR_WIDTH           : 224, SCR_HIGH: 320,
    FPS_MAX				: 33,

    //最大玩家数，可能用不到
    MAX_PLAYER          : 2,
    //Z轴层数
    MAX_LAYER           : 8,
    //碰撞分组
    MAX_GROUP           : 16,
    // 6个可以选的飞机
    MAX_PLAYER_PLANE    : 6,
    
    MAX_PLANE_SELECT_NUMBER : 6,
    BOMB_INTERVAL : 60,
    MAX_CHARGE_CD : 20,
    MAX_BOUNCE_COUNT : 20,
    COLLIDED_DRAW_INTERNAL : 6,
    DEFAULT_SENS : 15,
    PLAYER_TRACERT_SENS : 5,
//    SOUND_DISABLED		: true,
    
//    TICK_JUMP_FROM	: 5,	// 主序列时间跳跃
//    TICK_JUMP_TO	: 2400,
//    FORCE_ENIMY_LIFE : 1,	// 敌人生命强制为固定值
//    FORCE_PLAYER_LIFE : 1,	// 玩家几条命
//    FORCE_PLAYER_POWER : 2,	// 玩家强制初始武器等级
//    FORCE_PLAYER_CHARGE : 3,	// 玩家强制蓄力级别
//    PLAYER_SELECT_DEFAULT : 1,	// 玩家默认选择飞机
//    PLAYER_SELECT_WAIT : 0,		// 玩家选择飞机等待时间
//    PLAYER_SELECTD_WAIT : 0,		// 玩家选择飞机后等待时间
//    STAGE_START_IMAGE_INTERVAL_SKIP : 60,	// 关卡开头跳过等待
  };

  // 创建一个Pixi 应用
  let app = new PIXI.Application({width: Const.SCR_WIDTH, height: Const.SCR_HIGH});

  // 把 Pixi 应用中创建出来的 canvas 添加到页面上
  document.body.appendChild(app.view);

  let SpriteUtil = new SpriteUtilities(PIXI);

  let game = new manager();
  app.ticker.add(function() { game.appTicker(); });

  //全屏
  let [width,height] = [document.documentElement.clientWidth,document.documentElement.clientHeight];
  let ratio = Const.SCR_WIDTH / Const.SCR_HIGH;
  if(width / height > ratio)
	  width = Math.floor(height * ratio)
  else
	  height = Math.floor(width / ratio)

  app.view.style = `width:${width}px;height:${height}px;`;
  app.stage.scale.set(Math.min(width / Const.SCR_WIDTH, height / Const.SCR_HIGH));
  app.renderer.resize(width, height);

  //接收键盘事件
  window.addEventListener("keydown", function (event) {
    game.keyEvent("keydown", event.code)
  }, false);
  window.addEventListener("keyup", function (event) {
    game.keyEvent("keyup", event.code)
  }, false);

</script>
<script src="core/virtualKey.js"></script>
</body>
</html>